<script>
  function loadState() {
    var mini = window.localStorage.getItem('wgxAdmin-miniSidebar');
    mini = mini ? parseInt(mini) : 0;
    /** @type {HTMLElement} */
    var ele = document.getElementsByTagName('body')[0];
    if (mini) {
      ele.classList.add('sidebar-mini');
    } else {
      ele.classList.remove('sidebar-mini');
    }

    var sidebar = null;
    /** @type {HTMLCollection} */
    var eleList = document.getElementsByClassName('main-container');
    var i = 0, l = null;
    for (i = 0; i < eleList.length; i++) {
      l = eleList[i].getElementsByClassName('sidebar');
      if (l && l.length > 0) {
        sidebar = l[0];
        break;
      }
    }
    var flag = 0;
    if (sidebar) {
      flag = window.localStorage.getItem('wgxAdmin-showSidebar');
      flag = flag ? parseInt(flag) : 0;
      if (flag) {
        sidebar.classList.add('show');
      } else {
        sidebar.classList.remove('show');
      }

      var sidebarCollapse = null;
      eleList = sidebar.getElementsByClassName('sidebar-content');
      for (i = 0; i < eleList.length; i++) {
        l = eleList[i].getElementsByClassName('sidebar-collapse');
        if (l && l.length > 0) {
          sidebarCollapse = l[0];
          break;
        }
      }
      if (sidebarCollapse) {
        var icon = sidebarCollapse.getElementsByClassName('icon');
        if (icon && icon.length > 0) {
          icon = icon[0];
          icon.classList.remove('fa-angle-double-left');
          icon.classList.remove('fa-angle-double-right');
          if (mini) {
            icon.classList.add('fa-angle-double-right');
          } else {
            icon.classList.add('fa-angle-double-left');
          }
        }
      }
    }
  };
  loadState();
</script>
<script src="/wgx_admin_static/jquery-3.6.1.min.js"></script>
<script src="/wgx_admin_static/admin/wgxadmin.js"></script>